if(KMPKG_TARGET_IS_WINDOWS)
    kmpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

kmpkg_from_git(
    OUT_SOURCE_PATH SOURCE_PATH
    URL "https://gitee.com/kumo-hub/nsync.git"
    REF 13de152c2a1cd73ff4df97bd2c406b6d15d34af3
    PATCHES
        fix-install.patch
        export-targets.patch
)

kmpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
    OPTIONS
        -DNSYNC_ENABLE_TESTS=OFF
)
kmpkg_cmake_install()
kmpkg_copy_pdbs()

kmpkg_cmake_config_fixup(PACKAGE_NAME unofficial-nsync CONFIG_PATH share/unofficial-nsync)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
